package cn.stevenyang.services;

import org.apache.velocity.tools.generic.MathTool;

public class CompareService {
    private final MathTool mathTool = new MathTool();
    public Object eq(Object x, Object y) {
        return x == y;
    }
    public Object neq(Object x, Object y) {
        return x != y;
    }
    public Object lt(Object x, Object y) {
        return Double.parseDouble(mathTool.sub(x, y).toString()) < 0.0;
    }
    public Object gt(Object x, Object y) {
        return Double.parseDouble(mathTool.sub(x, y).toString()) > 0.0;
    }
    public Object lte(Object x, Object y) {
        return Double.parseDouble(mathTool.sub(x, y).toString()) <= 0.0;
    }
    public Object gte(Object x, Object y) {
        return Double.parseDouble(mathTool.sub(x, y).toString()) >= 0.0;
    }
}
